<%@ page import="BBS.bean.PageInfo" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <%
        String pageIdStr = request.getParameter("pageId");
        int pageId;
        if (null == pageIdStr) {
            Object pages = request.getSession().getAttribute("PAGES");
            pageId = ((List<PageInfo>)pages).get(0).getPageId();
        } else {
            pageId = Integer.parseInt(pageIdStr);
        }

        String msg = request.getParameter("msg");
        if (!"ok".equals(msg)) {
            response.sendRedirect("post?type=findPostByPageId&pageId=" + pageId);
        }
    %>

    <table width="90%">
        <tr>
            <th>标题</th>
            <th>发帖人</th>
            <th>发帖时间</th>
        </tr>
        <c:forEach var="post" items="${sessionScope.POSTS}">
            <tr>
                <td align="center">${post.title}</td>
                <td align="center">${post.postUser.userNickName}</td>
                <td align="center">${post.postTime}</td>
            </tr>
        </c:forEach>
    </table>
</body>
</html>
